package org.wiztools.te.plugin;

import java.net.URLDecoder;

import org.wiztools.te.TEMod;
import org.wiztools.te.TEProcessAdapter;

import java.io.UnsupportedEncodingException;

public class URLDecode extends TEProcessAdapter{
	private TEMod tem;
	public void setTEMod(TEMod tem){
		this.tem = tem;
	}
	
	public void action(){
		String str = tem.getSelectedText();
		if(str != null){
			try{
				tem.replaceSelection(URLDecoder.decode(str, "UTF-8"));
			}
			catch(UnsupportedEncodingException uee){
				assert false: uee;
			}
		}
	}
}
